package ssm.iterator;

public class BookShelf implements Aggregate{
	private Book[] books; // List의 역할을 하는 녀석
	private int last = 0;
	
	public BookShelf(int maxSize) {
		this.books = new Book[maxSize];
	}
	
	public Book getBookAt(int index){
		return books[index];
	}
	
	public void appendBook(Book book){
		this.books[last++] = book;
	}
	
	public int getLength(){
		return this.last;
	}
	
	@Override
	public Iterator iterator() {
		return new BookShelfIterator(this);
	}
}
